package com.info.examples.authentication;

import com.info.examples.authentication.annotation.Authentication;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Slf4j
@RestController
public class AuthenticationController {

    @GetMapping("/auth")
    @Authentication
    public String auth(@RequestParam Map<String, String> params, HttpServletRequest request) {
        // 执行具体业务逻辑
        params.forEach((k, v) -> log.info("{} = {}", k, v));
        return "success";
    }

}
